package org.vectrics.recruiter.struts.tag;

import org.apache.ecs.html.A;
import org.apache.ecs.html.IMG;
import org.vectrics.common.html.Cell;
import org.vectrics.common.html.Row;
import org.vectrics.common.html.Table;
import org.vectrics.hibernate.ThreadProperties;
import org.vectrics.html.menu.MenuTag;

public class MenuPublicTag extends MenuTag {

	private static final long serialVersionUID = 3022938937869896913L;

	public MenuPublicTag() {
		super();
	}

	protected String makeStartTag() {
		Table table = new Table();
		table.setCellPadding(0);
		table.setCellSpacing(1);
		
		Row row = table.addRow();
		Cell cell = row.addCell();
		String href = "/hrs-public/public/" + ThreadProperties.getUriDomainId() + "/index.do";
		cell.addElement(createLink(href, "menu.public.main.home"));
		
		cell = row.addCell();
		href = "/hrs-public/profile/" + ThreadProperties.getUriDomainId() + "/index.do";
		cell.addElement(createLink(href, "menu.public.main.candidate"));
		
		/** Agregado */
		cell = row.addCell();
		href = "/hrs-public/profile/" + ThreadProperties.getUriDomainId() + "/index.do";
		cell.addElement(createLink(href, "menu.public.main.profile"));
		/*fin Agregado*/
			
		cell = row.addCell();
		href = "/hrs-public/public/" + ThreadProperties.getUriDomainId() + "/job/job_search.do";
		cell.addElement(createLink(href, "menu.public.main.jobs"));
		
		return(table.toString());
	}
	
	public A createLink(String href, String captionCode) {
		String caption = this.getPhrase(captionCode);

		A a = new A();
		a.setHref(href);
		IMG img = new IMG();
		img.setWidth(120);
		img.setHeight(20);
		img.setBorder(0);
		img.setAlt(caption);
		img.setSrc(this.getContextPath() + "/dynagraphic/button.jpg?code=menu.public&caption=" + caption);
		a.addElement(img);
		return(a);
	}

}
